public with sharing class TaskEquipmentHandler {

	//投放仪器新增 或 更新的时候去设置关联的资产

	public static void updateEquip(List<TaskEquipment__c> teL ){

		Map<String,List<TaskEquipment__c>> mapTel = new  Map<String,List<TaskEquipment__c>> ();
		Set<String> imes = new Set<String>();
		Set<String> prouds  = new Set<String>();
		Map<Id,CooperationStandard__c> csMap  = new Map<Id,CooperationStandard__c>();

		for (TaskEquipment__c te: teL) {
			

			if(te.InstrumentName__c != null ) prouds.add(te.InstrumentName__c );
			if(te.SerialNo__c != null ) imes.add(te.SerialNo__c );
			csMap.put(te.Standers__c , null);

		}

		//总表
		for (CooperationStandard__c cs  :[select Id ,TerminalCustomer__c ,Account__c from CooperationStandard__c where Id in: csMap.keySet()] ) {
			csMap.put(cs.Id , cs);
		}

		//仪器
		for (Equipment__c e  :[select Id ,Account__c  ,Product__c,IMEINumber__c  from Equipment__c where Product__c in:prouds and IMEINumber__c in: imes ] ) {
			


			for ( TaskEquipment__c te: teL ) {
				
				if(te.InstrumentName__c == e.Product__c && te.SerialNo__c == e.IMEINumber__c 
					&& (csMap.get(te.Standers__c) != null && (csMap.get(te.Standers__c).Account__c == e.Account__c||csMap.get(te.Standers__c).TerminalCustomer__c == e.Account__c ))){

				}
			}

		}



	}
    
}